import com.iven.xie.aop.Business;
import com.iven.xie.aop.IBusiness2;
import com.iven.xie.aop.bytecodege.LogIntercept;
import org.springframework.cglib.proxy.Enhancer;

public class DynamicProxyDemo2 {

    public static void main(String[] args) {
        //创建一个织入器
        Enhancer enhancer = new Enhancer();
        //设置父类
        enhancer.setSuperclass(Business.class);
        //设置需要织入的逻辑
        enhancer.setCallback(new LogIntercept());
        //使用织入器创建子类
        IBusiness2 newBusiness = (IBusiness2) enhancer.create();
        newBusiness.doSomeThing2();
    }
}
